package com.test;

import com.test.controller.UserController;
import com.test.service.UserServiceIml;
import com.test.ykh.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-11-05
 * Time: 10:08
 */
public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");  //参数为 spring配置文件的名称
        UserController userController  = (UserController) context.getBean("userController");
//        UserServiceIml userServiceIml = context.getBean(UserServiceIml.class);
//        System.out.println(userServiceIml.getUser().toString());
     //   User user = (User) context.getBean("user");

//        userController2.getUser();
        // System.out.println(userController.getUser());
       // User user = userController.getUser();
        User user = userController.getUser();
//        System.out.println(user.getId()+" "+user.getName());
       // User user = (User) context.getBean("user",User.class);
        user.test();
    }
}
